HAL SDRAM control functions migration

This section provides information about the HAL SDRAM control functions migration.

HAL SDRAM enables and disables write protection

Note

  • The device is now passed as parameter to the write protection APIs to specify which memory one to protect.

HAL1

HAL2

HAL_SDRAM_WriteProtection_Enable(SDRAM_HandleTypeDef *hsdram);
HAL_SDRAM_EnableWriteProtection(hal_sdram_handle_t *hsdram,
                                hal_sdram_device_t device);
HAL_SDRAM_WriteProtection_Disable(SDRAM_HandleTypeDef *hsdram);
HAL_SDRAM_DisableWriteProtection(hal_sdram_handle_t *hsdram,
                                 hal_sdram_device_t device);

Note

  • HAL_SDRAM_IsEnabledWriteProtection() is added in HAL2 to check the write protection status for a given device.


HAL SDRAM get mode

HAL1

HAL2

uint32_t HAL_SDRAM_GetModeStatus(SDRAM_HandleTypeDef *hsdram);
hal_sdram_device_state_t HAL_SDRAM_GetDeviceMode(const hal_sdram_handle_t *hsdram,
                                                 hal_sdram_device_t device);

HAL SDRAM program refresh rate

HAL1

HAL2

HAL_SDRAM_ProgramRefreshRate(SDRAM_HandleTypeDef *hsdram,
                             uint32_t RefreshRate); // Clock cycle
HAL_SDRAM_SetRefreshRate(hal_sdram_handle_t *hsdram,
                         uint32_t refresh_period_ms); // milli second

HAL SDRAM sends command

Note

  • The device is now passed as parameter to the send command API to specify which memory to set.

HAL1

HAL2

HAL_SDRAM_SendCommand(SDRAM_HandleTypeDef *hsdram,
                      FMC_SDRAM_CommandTypeDef *Command,
                      uint32_t Timeout);
HAL_SDRAM_SendCommand(hal_sdram_handle_t *hsdram,
                      hal_sdram_device_t device,
                      hal_sdram_command_t *p_command_config,
                      uint32_t timeout_ms);

Related use case: Use case: Command process operation


HAL SDRAM sets auto refresh number

HAL1

HAL2

HAL_SDRAM_SetAutoRefreshNumber(SDRAM_HandleTypeDef *hsdram,
                               uint32_t AutoRefreshNumber);

Removed: The auto refresh number will be set in the parameter of hal_sdram_command_t that will be passed to HAL_SDRAM_SendCommand() if the the command is HAL_SDRAM_COMMAND_AUTOREFRESH.